package com.carlosli.sudoker.product.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lijiancheng
 * @date 2021/7/8
 */

@Configuration
public class RabbitConfig {
    @Bean
    public Queue queue() {
        return new Queue("queue");
    }

    @Bean
    public FanoutExchange fanoutExchange() {
        // TODO: 2021/7/14 广播 Exchange
        return null;
    }

    @Bean
    public MessageConverter messageConverter(ObjectMapper mapper) {
        return new Jackson2JsonMessageConverter(mapper);
    }
}
